'''
Created on Aug 10, 2012

@author: peng
'''
import happybase

connection = happybase.Connection('119.254.86.77',
                                  compat='0.90',
                                  table_prefix='beluga_analysis',
                                  autoconnect=False)
connection.open()

tables = connection.tables()
print tables
# table = connection.table('duration_distribution')
# table = connection.table('custom_event')
# table = connection.table('error_track')
# table = connection.table('basic_statistics')
# table = connection.table('version')
# table = connection.table('release_date')
# table = connection.table('retention')
table = connection.table('channel')

rows = table.scan()  # , '-', '8.10.0', '100TV', '0', '0']))#, 'theme', 'count', '1-1']))

# connection.close()

del_keys = ['365rl', '360bao', '155', '100tv', '91helper', '3g', '3grj', '3qdl']

for key, data in rows:
    print key.split('\t')[-1]
#    if key.split('\t')[-1] in del_keys:
#        print key, data


connection.close()
